package com.ssm.auth.infra.basic.service.impl;

import com.alibaba.fastjson.JSON;
import com.ssm.auth.infra.basic.entity.AuthUserRole;
import com.ssm.auth.infra.basic.mapper.AuthUserRoleDao;
import com.ssm.auth.infra.basic.service.AuthUserRoleService;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;


import javax.annotation.Resource;

/**
 * 用户角色表(AuthUserRole)表服务实现类
 *
 * @author makejava
 * @since 2024-12-13 10:07:40
 */
@Service("authUserRoleService")
@Log4j2
public class AuthUserRoleServiceImpl implements AuthUserRoleService {
    @Resource
    private AuthUserRoleDao authUserRoleDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public AuthUserRole queryById(Long id) {
        return this.authUserRoleDao.queryById(id);
    }

    /**
     * 新增数据
     *
     * @param authUserRole 实例对象
     * @return 实例对象
     */
    @Override
    public int insert(AuthUserRole authUserRole) {
        if(log.isInfoEnabled()) {
            log.info("AuthUserRoleService.add.authUserRole:{}", JSON.toJSONString(authUserRole));
        }
        return this.authUserRoleDao.insert(authUserRole);
    }

    /**
     * 修改数据
     *
     * @param authUserRole 实例对象
     * @return 实例对象
     */
    @Override
    public int update(AuthUserRole authUserRole) {
        return this.authUserRoleDao.update(authUserRole);
    }
}
